/**   
* @Title: ServletUtil.java 
* @Package com.element5th.comm 
* @Description: 
* @author 第五小组  
* @date 2012-11-9 上午9:09:57 
* @version V1.0   
*/ 
package com.element5th.comm;

import javax.servlet.http.HttpServletRequest;

/**
 * The Class ServletUtil.
 * 
 * @ClassName: ServletUtil
 * @Description:
 * @author 第五小组
 * @date 2012-11-9 上午9:09:57
 */
public class ServletUtil {
	
	/**
	 * Gets the integer.
	 * 
	 * @param request
	 *            the request
	 * @param key
	 *            the key
	 * @return the integer
	 */
	public static Integer getInteger(HttpServletRequest request, String key) {
		String str = request.getParameter(key);
		if(StringUtil.isEmpty(str)) {
			return null;
		}
		return Integer.parseInt(str);
	}
	
	/**
	 * Gets the double.
	 * 
	 * @param request
	 *            the request
	 * @param key
	 *            the key
	 * @return the double
	 */
	public static Double getDouble(HttpServletRequest request, String key) {
		String str = request.getParameter(key);
		if(str == null)
			return null;
		return Double.parseDouble(str);
	}
}
